<template xmlns:v-on="http://www.w3.org/1999/xhtml">
    <div class="set" style="height: 100%;" v-loading="loading" element-loading-text="加载中....">
        <div class="monthTop">
            日志列表
        </div>
        <div class="monthCen" style="padding-top: 20px;">
            <span style="float: left;line-height: 32px;">选择时间：</span>
            <div class="DatetimeBox" style="margin-left: 0px;">
                <el-date-picker @change="setEndDate" v-model="value1" type="date" placeholder="选择日期" :picker-options="pickerOptions0">
                </el-date-picker>
            </div>
            <span style="float: left;line-height: 32px;margin: 0 5px;color: #E7744A;">———</span>
            <div class="DatetimeBox">
                <el-date-picker @change="setEndDate1" v-model="value2" type="date" placeholder="选择日期" :picker-options="pickerOptions0">
                </el-date-picker>
            </div>
            <div class="staffSearch">
                <span>发送人：</span>
                <input :title="sendRange" v-model="sendRange" type="text" id="rangeInput" placeholder="选择部门，人员" @click='setDirectorClick' />
            </div>
        </div>
        <div class="monthCen">
            <span style="float: left;line-height: 32px;">选择类型：</span>
            <div class="selectBox">
                <el-select v-model="logTypeVal" placeholder="请选择">
                    <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.label">
                    </el-option>
                </el-select>
            </div>
        </div>
        <div class="monthCen">
            <span class="filtrate" @click="queryClick()">查询</span>
            <span class="filtrate" @click="delClick()">删除</span>
            <span class="filtrate" @click="exportClick()">导出</span>
        </div>
        <div class="monthBot">
            <div class="fixedTable" >
                <ul class="biaoge">
                    <li class="bgfirstli">
                        <div>
                            <el-checkbox v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
                        </div>
                        <div>发送人</div>
                        <div>发送时间</div>
                        <div>日志类型</div>
                    </li>
                    <li class="normalli" v-for="(item,index) in dataList" :key="index">
                        <div>
                            <el-checkbox-group v-model="checkList" @change="handleCheckedCitiesChange">
                                <el-checkbox :label="item" :key="item.name">{{dsa}}</el-checkbox>
                            </el-checkbox-group>
                        </div>
                        <div>{{item.sender}}</div>
                        <div>{{item.sendTime}}</div>
                        <div>{{item.logType}}</div>
                    </li>
                    <!-- 暂无数据 -->
                    <div class="noList" v-show="dataList.length == 0">
                        <div>
                            暂无日志
                        </div>
                    </div>
                </ul>
                <!-- 底部分页 -->
                <div class="lastLi" v-show="dataList.length > 0">
                    <div>
                        
                    </div>
                    <div>
                    <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page.sync="currentPage"
                        small
                        layout="prev, pager, next"
                        :total="totalNum">
                    </el-pagination>
                    </div>
                </div>
            </div>
        </div>
        <!--确认输出弹出框-->
        <div class="ModalsBox" v-show="isdelete">
            <div class="Modals">
                <div class="modaltitle">确认删除？</div>
                <div class="modalcontent">
                    <p>日志将被删除，删除后不可恢复!</p>
                    <div class="btnBox">
                        <input type="button" value="删除" @click='deleteSure'>
                        <input type="button" value="取消" @click="cancle">
                    </div>
                </div>
            </div>

        </div>
        <!--导出数据提示框-->
        <div class="ModalsBox" v-show="exportDataBox">
            <div class="Modals">
                <div class="modaltitle">休息一下</div>
                <div class="modalcontent">
                    <p>数据正在被导出，请勿关闭浏览器哦</p>
                    <div class="btnBox" style="margin-left:30px;">
                        <input type="button" value="确认" @click='exportDataClick'>
                    </div>
                </div>
            </div>

        </div>
        <!--弹出框选择部门人员组件-->
        <div v-show='ModalsShow' class="ModalsmemBox">
            <div class="Modalsmem">
                <div class="ModalsmemTop">
                    {{selectBranchTitle}}
                </div>
                <div class="ModalsmemCenter">
                    <div class="centerLeft">
                        <div class="centerLeftTop">
                            {{selectBranchTitle}}
                        </div>
                        <div class="centerLeftBot">
                            <div class="centerLeftBotOne">
                                <div v-show="selectBranchTitle == '选择人员' || selectBranchTitle == '选择人员或部门'">
                                    <div class="centerLeftBotOneL">
                                        <img src="/static/img/watchsee.png" alt="">
                                    </div>
                                    <div class="centerLeftBotOneI">
                                        <input type="text" placeholder="搜索" v-model.trim="searchsmemVal">
                                    </div>
                                     <div v-show="searchsmemVal != ''" class="centerLeftBotOneX" @click="clearSearchClick">
										<img src="/static/img/Group.png" alt="">
									</div>
                                </div>
                            </div>
                            <div class="centerLeftBotTwo">
                                <ul>
                                    <li v-for="(item,index) in navLists" :key="index" @click="navClick(index)">
                                        <div v-show="index !== 0">
                                            >
                                        </div>
                                        <div>
                                            {{item.name}}
                                        </div>
                                    </li>
                                </ul>
                            </div>
                            <div class="centerLeftBotThr">
                                <div>
                                    <el-checkbox v-model="checkedDesign" @change="numChangeDesign"></el-checkbox>
                                </div>
                                <div>
                                    <span>全选</span>
                                </div>
                            </div>
                            <div class="centerLeftBotFour">
                                <ul>
                                    <li v-for="(item,index) in selectLeftlists" :key="index">
                                        <div class="centerLeftBotFourLiL" @click="lefthandleCheckedCitiesChange(index)">
                                            <div v-show="item.type == 1 && (selectBranchTitle == '选择部门' || selectBranchTitle == '选择人员或部门')">
                                                <img v-show="item.open" src="/static/img/on@2x.png" alt="">
                                                <img v-show="!item.open" src="/static/img/out@2x.png" alt="">
                                            </div>
                                            <div v-show="item.type == 2 && (selectBranchTitle == '选择人员' || selectBranchTitle == '选择人员或部门')">
                                                <img v-show="item.open" src="/static/img/on@2x.png" alt="">
                                                <img v-show="!item.open" src="/static/img/out@2x.png" alt="">
                                            </div>
                                            <div v-show="item.type == 1">
                                                <img src="/static/img/member@2x.png" alt="">
                                            </div>
                                            <div :title="item.name" :class="{grayColor:item.isAuth == 0 || item.isActivite ==0}">
                                                {{item.name}}-{{item.type | typeFun}}
                                            </div>
                                        </div>
                                        <div v-if="item.type == 1" class="centerLeftBotFourLiR" @click="leftNextClick(index)">
                                            <div>
                                                <img src="/static/img/can@2x.png" alt="">
                                            </div>
                                            <div>
                                                下级
                                            </div>
                                        </div>
                                        <div v-else class="centerLeftBotFourLiR">
                                            <!-- <div>
                                                <img src="/static/img/canon@2x.png" alt="">
                                            </div>
                                            <div>
                                                下级
                                            </div> -->
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="centerCenter">
                        <div @click="commodityLeftClick">
                            <img src="/static/img/xright@2x.png" alt="">
                        </div>
                        <div @click="commodityRightClick">
                            <img src="/static/img/xleft@2x.png" alt="">
                        </div>
                    </div>
                    <div class="centerRight">
                        <div class="centerRightTop">
                            {{selectBranchTitleAlready}}
                        </div>
                        <div class="centerRightBot">
                            <ul>
                                <li v-for="(item,index) in selectRightlists" :key="index" @click="righthandleCheckedCitiesChange(index)">
                                    <div class="centerRightBotLiL">
                                        <div>
                                            <img v-show="item.open" src="/static/img/on@2x.png" alt="">
                                            <img v-show="!item.open" src="/static/img/out@2x.png" alt="">
                                        </div>
                                        <div v-show="item.type == 1">
                                            <img src="/static/img/member@2x.png" alt="">
                                        </div>
                                        <div :title="item.name">
                                            {{item.name}}-{{item.type | typeFun}}
                                        </div>
                                    </div>
                                    <div class="centerRightBotLiR">
                                        <div>
                                            <!-- <img src="/static/img/清空@2x.png" alt=""> -->
                                        </div>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="ModalsmemBot">
                    <div @click="confirmClick">
                        确定
                    </div>
                    <div @click="cancelClick">
                        取消
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
require("../../../../api/api.js");
import { mapActions } from "vuex";
export default {
  name: "set",
  data() {
    return {
      exportDataBox:false,
      loading:false,
      pickerOptions0: {
        disabledDate(time) {
          return Date.now() < time.getTime();
        }
      }, //日期控件只是显示当前日期以前的
      isdelete: false, //删除提示是否出现
      dsa: "", //复选框前面不加序号
      dataList: [], //日志列表
      checkList: [], //选中的数组
      checkAll: false, //是否全选
      value1: "", //筛选的开始时间
      value2: "", //筛选的结束时间
      options: [
        {
          value: "1",
          label: "日报"
        },
        {
          value: "2",
          label: "周报"
        },
        {
          value: "3",
          label: "月报"
        }
      ], //日志类型的数组
      logTypeVal: "0", //筛选的日报类型
      pageSizeNum: 10,
      currentPage: 1,
      totalNum: 0,
      oid: "",
      uid: "",
      // 选择人员弹框组件样式
      ModalsShow: false, //弹出框选择部门、人员是否显示
      selectBranchTitle: "选择人员或部门", //弹框标题
      searchsmemVal: "", //弹框搜索input内容
      navLists: [], //弹框内导航数组
      checkedDesign: false, //全选按钮是否选中
      selectLeftlists: [], //左侧选中的数组
      selectBranchTitleAlready: "已选人员", //右侧选中的标题
      selectRightlists: [], //右侧选中的数组
      selectMembersVal_3: [], //给后台传的选中的数据格式
      ischeckedDesignBranch: false, //判断权限，表示是否能全选的标记
      visibleMans: [], //用来展示选中的部门或人员的数组
      sendRange: "", //显示的选中的部门或人员的字符串
      labelIds:[],
      a:'',
      b:'',
      appId:'',
      appIdArr:[]
    };
  },

  created: function() {
    this.loading = true
    sessionStorage.removeItem('deptIds')
    sessionStorage.removeItem('userIds')   
    this.companyName = sessionStorage.getItem("orgName");
    if (sessionStorage.getItem("orgId") == undefined) {
      return;
    }
    // 若此人中途无权限，则跳到登录页
    this.getbusiness({
      oid: sessionStorage.getItem("orgId"),
      uid: sessionStorage.getItem("userId")
    })
      .then(data => {
        if (data.code == "100005") {
          this.$message({
            type: "info",
            message: "对不起，没有权限"
          });
          this.$router.push({
            path: "/login"
          });
        }
      })
      .catch(msg => {
        if (JSON.parse(msg.bodyText).code == "188888") {
          this.$message({
            type: "info",
            message: JSON.parse(msg.bodyText).msg
          });
          this.$router.push({
            path: "/login"
          });
        } else {
          this.$message({
            type: "info",
            message: "服务器错误!"
          });
        }
      });
    this.oid = sessionStorage.getItem("orgId");
    this.uid = sessionStorage.getItem("userId");
    this.appIdArr = JSON.parse(sessionStorage.getItem('business')).authList
    for(let i=0;i<this.appIdArr.length;i++){
      if(this.appIdArr[i].authName == '日志'){
        this.appId = this.appIdArr[i].appId
      }
    }
    this.getlogListFun(0)
  },
  watch: {
    searchsmemVal: function(val) {
      var self = this;
      self.selectLeftlists = [];
      if (val.length == 0) {
        self.listFun();
      } else {
        // 在公司所有的人员中进行查找
        self
          .getRequestList({
            oid: self.oid,
            uid: self.uid,
            searchKey: val,
            appId:self.appId
          })
          .then(data => {
            if (data.code == "000000") {
              data.data.forEach(function(ele, ind) {
                self.selectLeftlists.push({
                  name: ele.name,
                  open: false,
                  parentId: ele.userId,
                  type: 2,
                  id: ele.userId,
                  isAuth: ele.isAuth,
                  isActivite: ele.isActivite
                });
              });
              // 点击数组更新后，循环遍历与右侧进行对比是否选中
              self.selectLeftlists.forEach(function(eleLeft, eleLeftInd) {
                self.selectRightlists.forEach(function(eleRight, rightInd) {
                  if (eleLeft.id == eleRight.id) {
                    self.selectLeftlists[eleLeftInd].open = true;
                  }
                });
              });
              self.judgeSelectAll();
            } else {
              self.$message({
                type: "info",
                message: data.msg
              });
            }
          })
          .catch(msg => {
            if (JSON.parse(msg.bodyText).code == "188888") {
              this.$message({
                type: "info",
                message: JSON.parse(msg.bodyText).msg
              });
              this.$router.push({
                path: "/login"
              });
            } else {
              this.$message({
                type: "info",
                message: "服务器错误!"
              });
            }
          });
      }
    }
  },
  filters: {
    typeFun: function(val) {
      if (val == 1) {
        return "部门";
      } else {
        return "人员";
      }
    },
    timeFun: function(val) {
      if (val) {
        var standardTime = new Date(val * 1000);
        var y, m, d, h, f;
        y = standardTime.getFullYear();
        m = standardTime.getMonth() + 1;
        m = m > 9 ? m : "0" + m;
        d = standardTime.getDate();
        d = d > 9 ? d : "0" + d;
        h = standardTime.getHours();
        h = h > 9 ? h : "0" + h;
        f = standardTime.getMinutes();
        f = f > 9 ? f : "0" + f;
        return y + "-" + m + "-" + d + " " + h + ":" + f;
      } else {
        return "暂无";
      }
    }
  },
  methods: {
    exportDataClick(){
       this.exportDataBox = false
    },
    setEndDate1(val){
      this.a=val
    },
    setEndDate(val){
      this.b=val
    },
    listFun() {
      var self = this;
      self.selectLeftlists = [];
      this.getdeptstaff({
        oid: self.oid,
        uid: self.uid,
        deptId: "",
        appId:self.appId
      })
        .then(data => {
          if (data.code == "000000") {
            self.navLists = [{ name: "通讯录", deptId: "" }];
            self.selectLeftlists.push({
              name: data.data.name,
              open: false,
              parentId: 0,
              type: data.data.type,
              id: data.data.id,
              isAuth: data.data.isAuth,
              isActivite: data.data.isActivite
            });
            if (self.selectRightlists.length > 0) {
              // 点击数组更新后，循环遍历与右侧进行对比是否选中
              self.selectLeftlists.forEach(function(eleLeft, eleLeftInd) {
                self.selectRightlists.forEach(function(eleRight, rightInd) {
                  if (eleLeft.id == eleRight.id) {
                    self.selectLeftlists[eleLeftInd].open = true;
                  }
                });
              });
              self.judgeSelectAll();
            }
          } else if (data.code == "100005") {
            self.$message(data.msg);
            self.$router.push({
              path: "/login"
            });
          } else {
            self.$message(data.msg);
          }
        })
        .catch(msg => {
          if (JSON.parse(msg.bodyText).code == "188888") {
            this.$message({
              type: "info",
              message: JSON.parse(msg.bodyText).msg
            });
            this.$router.push({
              path: "/login"
            });
          } else {
            this.$message({
              type: "info",
              message: "服务器错误!"
            });
          }
        });
    },
    navClick(index) {
      var self = this;
      this.getdeptstaff({
        oid: self.oid,
        uid: self.uid,
        deptId: self.navLists[index].deptId,
        appId:self.appId
      })
        .then(data => {
          if (data.code == "000000") {
            self.selectLeftlists = [];
            var start = index + 1;
            self.navLists.splice(index + 1, self.navLists.length - start);
            // 如果是公司走这里
            if (self.navLists[index].deptId == "") {
              self.selectLeftlists.push({
                name: data.data.name,
                open: false,
                parentId: 0,
                type: data.data.type,
                id: data.data.id,
                isAuth: data.data.isAuth,
                isActivite: data.data.isActivite
              });
            } else {
              data.data.forEach(function(ele, ind) {
                self.selectLeftlists.push({
                  name: ele.name,
                  open: false,
                  parentId: ele.parentId,
                  type: ele.type,
                  id: ele.id,
                  isAuth: ele.isAuth,
                  isActivite: ele.isActivite
                });
              });
            }
            // 点击数组更新后，循环遍历与右侧进行对比是否选中
            self.selectLeftlists.forEach(function(eleLeft, eleLeftInd) {
              self.selectRightlists.forEach(function(eleRight, rightInd) {
                if (eleLeft.id == eleRight.id) {
                  self.selectLeftlists[eleLeftInd].open = true;
                }
              });
            });
            self.judgeSelectAll();
          } else if (data.code == "100005") {
            self.$message(data.msg);
            self.$router.push({
              path: "/login"
            });
          } else {
            self.$message(data.msg);
          }
        })
        .catch(msg => {
          if (JSON.parse(msg.bodyText).code == "188888") {
            this.$message({
              type: "info",
              message: JSON.parse(msg.bodyText).msg
            });
            this.$router.push({
              path: "/login"
            });
          } else {
            this.$message({
              type: "info",
              message: "服务器错误!"
            });
          }
        });
    },
    // 下一级
    leftNextClick(index) {
      var self = this;
      this.getdeptstaff({
        oid: self.oid,
        uid: self.uid,
        deptId: self.selectLeftlists[index].id,
        appId:self.appId
      })
        .then(data => {
          if (data.code == "000000") {
            self.navLists.push({
              name: self.selectLeftlists[index].name,
              deptId: self.selectLeftlists[index].id
            });
            self.selectLeftlists = [];
            data.data.forEach(function(ele, ind) {
              self.selectLeftlists.push({
                name: ele.name,
                open: false,
                parentId: ele.parentId,
                type: ele.type,
                id: ele.id,
                isAuth: ele.isAuth,
                isActivite: ele.isActivite
              });
            });
            self.selectLeftlists.forEach(function(eleLeft, eleLeftInd) {
              self.selectRightlists.forEach(function(eleRight, rightInd) {
                if (eleLeft.id == eleRight.id) {
                  self.selectLeftlists[eleLeftInd].open = true;
                }
              });
            });
            self.judgeSelectAll();
          } else if (data.code == "100005") {
            self.$message(data.msg);
            self.$router.push({
              path: "/login"
            });
          } else {
            self.$message(data.msg);
          }
        })
        .catch(msg => {
          if (JSON.parse(msg.bodyText).code == "188888") {
            this.$message({
              type: "info",
              message: JSON.parse(msg.bodyText).msg
            });
            this.$router.push({
              path: "/login"
            });
          } else {
            this.$message({
              type: "info",
              message: "服务器错误!"
            });
          }
        });
    },
    // 取消选中商品
    righthandleCheckedCitiesChange(index) {
      var self = this;
      this.selectRightlists[index].open = !this.selectRightlists[index].open;
    },
    // 点击向左移动按钮
    commodityRightClick() {
      var self = this;
      var rights = [];
      var seRight = [];
      self.selectRightlists.forEach(function(ele, ind) {
        if (ele.open == false) {
          rights.push({
            name: ele.name,
            open: false,
            parentId: ele.parentId,
            type: ele.type,
            id: ele.id
          });
        } else {
          seRight.push({
            name: ele.name,
            open: false,
            parentId: ele.parentId,
            type: ele.type,
            id: ele.id
          });
        }
      });
      self.selectRightlists = rights;
      this.selectLeftlists.forEach(function(eleL, indL) {
        seRight.forEach(function(ele, ind) {
          if (eleL.id === ele.id) {
            self.selectLeftlists[indL].open = false;
          }
        });
      });
      this.selectLeftlists.forEach(function(eleL, indL) {
        rights.forEach(function(ele, ind) {
          if (eleL.id === ele.id) {
            self.selectLeftlists[indL].open = true;
          }
        });
      });
      this.judgeSelectAll();
    },
    // 判断是否全选
    judgeSelectAll() {
      var rArrs = [];
      this.selectLeftlists.forEach(function(ele, ind) {
        if (ele.open == true) {
          rArrs.push({
            clickNode: ele.clickNode,
            name: ele.name,
            open: false,
            parentId: ele.parentId,
            type: ele.type,
            id: ele.id,
            isAuth: ele.isAuth,
            isActivite: ele.isActivite
          });
        }
      });
      var hash = {};
      rArrs = rArrs.reduce(function(item, next) {
        hash[next.id] ? "" : (hash[next.id] = true && item.push(next));
        return item;
      }, []);
      if (rArrs.length == this.selectLeftlists.length && rArrs.length !== 0) {
        this.checkedDesign = true;
      } else {
        this.checkedDesign = false;
      }
    },
    // 添加选中商品
    lefthandleCheckedCitiesChange(index) {
      var self = this;
      if (this.selectBranchTitle == "选择人员或部门") {
        if (
          self.selectLeftlists[index].isAuth == 0 &&
          self.selectLeftlists[index].type == 1
        ) {
          //   this.selectLeftlists[index].open = this.selectLeftlists[index].open;
        } else if (
          self.selectLeftlists[index].isActivite == 0 &&
          self.selectLeftlists[index].type == 2
        ) {
          // 不做任何操作
        } else {
          this.selectLeftlists[index].open = !this.selectLeftlists[index].open;
        }
      }
      this.judgeSelectAll();
    },
    // 点击向右移动
    commodityLeftClick() {
      var self = this;
      var rArrs = [];
      this.selectLeftlists.forEach(function(ele, ind) {
        if (ele.open == true) {
          self.selectRightlists.push({
            clickNode: ele.clickNode,
            name: ele.name,
            open: false,
            parentId: ele.parentId,
            type: ele.type,
            id: ele.id,
            isAuth: ele.isAuth,
            isActivite: ele.isActivite
          });
        }
      });
      var hash = {};
      self.selectRightlists = self.selectRightlists.reduce(function(
        item,
        next
      ) {
        hash[next.id] ? "" : (hash[next.id] = true && item.push(next));
        return item;
      },
      []);
    },
    // 所有序号被选中时
    numChangeDesign(event) {
      var self = this;
      self.ischeckedDesignBranch = false;
      self.selectLeftlists.forEach(function(ele, ind) {
        if (
          (ele.isAuth == 0 && ele.type == 1) ||
          (ele.isActivite == 0 && ele.type == 2)
        ) {
          self.ischeckedDesignBranch = true;
        }
      });
      if (self.ischeckedDesignBranch == true) {
        self.checkedDesign = false;
        self.$message("不能选择没有权限的部门或未激活的人员！");
      } else {
        if (event.target.checked) {
          this.selectLeftlists.forEach(function(ele, ind) {
            ele.open = true;
          });
        } else {
          this.selectLeftlists.forEach(function(ele, ind) {
            ele.open = false;
          });
        }
      }
    },
    //选择成员弹出框确认
    confirmClick() {
      var arr = this.selectRightlists.map(function(data) {
        return { adminName: data.name, adminId: data.id, type: data.type };
      });
      this.ModalsShow = false;
      this.visibleMans = [];
      for (var i = 0; i < arr.length; i++) {
        this.visibleMans.push(arr[i]);
      }
      this.sendRange = this.visibleMans
        .map(function(data) {
          return data.adminName;
        })
        .join(",");
      this.selectMembersVal_3 = this.visibleMans.map(function(data) {
        return { id: data.adminId, type: data.type };
      });
      let deptIdArr = []
      let userIdArr = []
      for(i=0;i<this.selectMembersVal_3.length;i++){
        if(this.selectMembersVal_3[i].type == 1){
           deptIdArr.push(this.selectMembersVal_3[i].id)
           self.deptIds = deptIdArr.join(',') 
           sessionStorage.setItem('deptIds',self.deptIds)
        }else{
          userIdArr.push(this.selectMembersVal_3[i].id)
          self.userIds = userIdArr.join(',')
          sessionStorage.setItem("userIds",self.userIds)
        }
      }
    },
    // 选择成员弹出框取消
    cancelClick() {
      this.ModalsShow = false;
    },
    // 点击设置发送人
    setDirectorClick(m) {
      var self = this;
      self.listFun();
      document.getElementById("rangeInput").blur();
      self.searchsmemVal = "";
      this.ModalsShow = true;
      this.selectRightlists = [];
      this.selectBranchTitle = "选择人员或部门";
      this.selectBranchTitleAlready = "已选人员或部门";
      if (this.visibleMans.length > 0) {
        this.visibleMans.forEach(function(ele, index) {
          self.selectRightlists.push({
            name: ele.adminName,
            id: ele.adminId,
            open: false,
            type: ele.type
          });
        });
        self.selectLeftlists.forEach(function(ele, index) {
          ele.open = false;
        });
        self.selectLeftlists.forEach(function(eleLeft, eleLeftInd) {
          self.selectRightlists.forEach(function(eleRight, rightInd) {
            if (eleLeft.id == eleRight.id) {
              self.selectLeftlists[eleLeftInd].open = true;
            }
          });
        });
        this.judgeSelectAll();
      } else {
        this.selectRightlists = [];
        self.selectLeftlists.forEach(function(ele, index) {
          ele.open = false;
        });
      }
      this.judgeSelectAll();
    },
    // 清空搜索input内容
    clearSearchClick() {
      this.searchsmemVal = "";
    },
    // 点击导出按钮
    exportClick() {
      let self = this
      self.exportDataBox = true
      let aa
      let bb
      if(self.logTypeVal == '0'){
        self.logTypeVal = ''
      }
      if(sessionStorage.getItem("deptIds") == null){
         aa = ''
      }else{
        aa = sessionStorage.getItem("deptIds")
      }
      if(sessionStorage.getItem("userIds") == null){
        bb = ''
      }else{
        bb = sessionStorage.getItem("userIds")
      }
      window.location.href =
      global.logsIp +
      "/api-log/log/data/export" +
      '?oid=' + sessionStorage.getItem('orgId') + '&logType=' + self.logTypeVal 
        + '&startTime=' + self.b + '&endTime=' +  self.a
        + '&deptId=' + aa + '&uid=' + bb + '&pageNo=' 
        + self.currentPage+ '&pageSize=10'   
        + '&access_token=' + sessionStorage.getItem('accessToken')
    },
    // 获取日志列表
    getlogListFun(m) {
      var self = this;
      if(m == 0){
        self.currentPage = 1
      }
      if(self.logTypeVal == '0'){
        self.logTypeVal = ''
      }
      if(self.a == undefined){
        self.a = ''
      }
      if(self.b == undefined){
        self.b = ''
      }
      if(self.sendRange == ''){
      self
        .getLogDataGet({
          oid:sessionStorage.getItem('orgId'),
          logType:self.logTypeVal,
          startTime:self.b,
          endTime:self.a,
          deptId:'',
          uid:'',
          pageNo:self.currentPage,
          pageSize:10
        })
        .then(data => {
          if (data.code == "000000") {
              self.dataList = data.data.rows
              self.totalNum = data.data.totalCount
              self.loading = false
          } else {
            self.$message(data.msg);
            self.loading = false
          }
        })
        .catch(msg => {
          if (JSON.parse(msg.bodyText).code == "188888") {
            this.$message({
              type: "info",
              message: JSON.parse(msg.bodyText).msg
            });
            this.$router.push({
              path: "/login"
            });
          } else {
            this.$message({
              type: "info",
              message: "服务器错误!"
            });
          }
          this.loading = false
        });
      }else{
      self
        .getLogDataGet({
          oid:sessionStorage.getItem('orgId'),
          logType:self.logTypeVal,
          startTime:self.b,
          endTime:self.a,
          deptId:sessionStorage.getItem("deptIds"),
          uid:sessionStorage.getItem("userIds"),
          pageNo:self.currentPage,
          pageSize:10
        })
        .then(data => {
          if (data.code == "000000") {
              self.dataList = data.data.rows
              self.totalNum = data.data.totalCount
              self.loading = false
          } else {
            self.$message(data.msg);
            self.loading = false
          }
        })
        .catch(msg => {
          if (JSON.parse(msg.bodyText).code == "188888") {
            this.$message({
              type: "info",
              message: JSON.parse(msg.bodyText).msg
            });
            this.$router.push({
              path: "/login"
            });
          } else {
            this.$message({
              type: "info",
              message: "服务器错误!"
            });
          }
          this.loading = false
        });
      }
      
    },
    // 按条件查询日志列表
    queryClick() {
      if(this.value1 !== ''){
        if(this.value2 == ''){
          this.$message({
            type:'info',
            message:'请选择结束时间'
          })
          return
        }
      }
      if(this.value2 !== ''){
        if(this.value1 == ''){
          this.$message({
            type:'info',
            message:'请选择开始时间'
          })
          return
        }
      } 
      if (this.value1 > this.value2) {
        this.$message("开始时间不可以大于结束时间");
        return;
      } else if (this.value2 - this.value1 > 86400000 * 30) {
       console.log(this.value1,this.value2)
        this.$message("查询时间间隔不能大于一个月");
        return;
      } else {

        this.getlogListFun(0);
      }

    },
    cancle() {
      this.isdelete = false;
    },
    //分页
    handleSizeChange(val) {
      //   this.pageSizeNum = val;
      //   this.getnoticeListFun();
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.getlogListFun(1);
    },
    // selectMembers() {
    //   this.Modals = true;
    // },
    // abolishmem() {
    //   this.Modals = false;
    // },
    // 序号选取
    handleCheckedCitiesChange(value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.dataList.length;
      this.labelIds = this.checkList.map(function(data) {
        return data.logId;
      });
      //   var string = a.join(",");
      //   this.idstring = string;
    },
    // 点击全选
    handleCheckAllChange(event) {
      this.checkList = event.target.checked ? this.dataList : [];
      this.labelIds = this.checkList.map(function(data) {
        return data.logId;
      });
      //   var string = a.join(",");
      //   this.idstring = string;
    },
    // 点击确定删除
    deleteSure() {
      var self = this;
      self
        .getLogDataDelete({
          oid:sessionStorage.getItem('orgId'),
          logId:self.labelIds.join(',')
        })
        .then(data => {
          if (data.code == "000000") {
            self.$message({
              type: "success",
              message: "删除成功"
            });
            self.checkList = [];
            self.checkAll = false;
            self.isdelete = false
            self.getlogListFun(1);
          } else {
            self.$message(data.msg);
          }
        })
        .catch(msg => {
          if (JSON.parse(msg.bodyText).code == "188888") {
            this.$message({
              type: "info",
              message: JSON.parse(msg.bodyText).msg
            });
            this.$router.push({
              path: "/login"
            });
          } else {
            this.$message({
              type: "info",
              message: "服务器错误!"
            });
          }
        });
    },
    // 点击删除按钮
    delClick() {
      if (this.checkList.length == 0) {
        this.$message("请选择人员！");
      } else {
        this.isdelete = true;
      }
    },
    ...mapActions(["getbusiness", "getdeptstaff", "getRequestList",'getLogDataGet','getLogDataDelete'])
  }
};
</script>
<style scoped>
/*弹窗*/

.Modals {
  background: #fff;
  height: 200px;
  width: 324px;
}

.modaltitle {
  height: 34px;
  line-height: 64px;
  text-align: center;
  color: #303030;
  font-size: 16px;
  background: #ffffff;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
}

.modalcontent p {
  text-align: center;
  margin-top: 52px;
  margin-bottom: 48px;
}

.btnBox {
  text-align: center;
  margin-top: -10px;
}

.btnBox input {
  width: 80px;
  height: 34px;
  line-height: 34px;
  font-size: 16px;
  color: #fff;
  background: #ffffff;
}

.btnBox input:nth-child(1) {
  margin-right: 30px;
    border: solid 1px #e97449;
    color: #e97449;
}

.btnBox input:nth-child(2) {
      margin-left: 30px;
    border: solid 1px #afafaf;
    color: #afafaf;
}
/*表格*/

.biaoge {
  width: 100%;
}

.biaoge > li {
  /*height: 56px;*/
}

.biaoge > li > div {
  height: 100%;
  text-align: center;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  height: 46px;
}

.biaoge > li > div:nth-child(1),
.biaoge > li > div:nth-child(4) {
  width: 125px;
}

.biaoge > li > div:nth-child(2) {
  width: 232px;
}

.biaoge > li > div:nth-child(3) {
  width: 220px;
}

.bgfirstli {
  height: 48px;
  line-height: 48px;
  background: #f4f4f6;
}

.normalli {
  height: 45px;
  line-height: 45px;
  border-bottom: 1px solid #f4f4f6;
}

.normalli label {
  margin-left: -29px;
}

.DatetimeBox {
  float: left;
  width: 120px !important;
  height: 32px;
  overflow: hidden;
  position: relative;
  border: 1px solid #e7744a;
  border-radius: 4px;
}

.DatetimeBox .el-date-editor.el-date-editor {
  width: 123px;
  margin-left: -2px;
  margin-top: -3px;
}

.selectBox {
  width: 120px !important;
  height: 32px;
  overflow: hidden;
  position: relative;
  border: 1px solid #e7744a;
  border-radius: 4px;
}

.selectBox .el-select {
  width: 123px;
  margin-left: -2px;
  margin-top: -3px;
}

.pagination {
  float: right;
  margin-right: 20px;
}

.monthTop {
  width: calc(100%-88px);
  height: auto;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  margin-left: 44px;
  margin-right: 44px;
  padding-top: 20px;
  padding-bottom: 12px;
  color: #303030;
  font-size: 14px;
}

.monthCen {
  width: calc(100%-88px);
  height: auto;
  margin-left: 44px;
  margin-right: 44px;
  padding-bottom: 26px;
  color: #303030;
  font-size: 14px;
  overflow: hidden;
}

.staffSearch {
  display: inline-block;
  width: auto;
  float: right;
  margin-top: 0;
}

.staffSearch input {
  border: 1px solid #e7744a;
  width: 200px;
  height: 32px;
  padding-left: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.filtrate {
  float: right;
  width: 96px;
  height: 27px;
  border: 1px solid #e7744a;
  border-radius: 4px;
  color: #e7744a;
  text-align: center;
  line-height: 27px;
  font-size: 14px;
  cursor: pointer;
  margin-left: 26px;
}

.monthBot {
  width: calc(100%-88px);
  height: auto;
  margin-left: 44px;
  margin-right: 44px;
}

.fixedTable {
  width: calc(100%-88px);
}
.lastLi {
  height: 60px;
  display: flex;
  justify-content: space-between;
  margin: 35px 0;
}
.noList div {
  color: #ccc;
  text-align: center;
  margin: 50px;
}
/***********************************弹出组件***************************/
/*成员弹出*/

.centerCenter > div {
  width: 30px;
  height: 30px;
  background-color: #fff;
  color: #000;
  margin-top: 10px;
  margin-bottom: 10px;
  cursor: pointer;
}

.centerCenter {
  width: 50px;
  height: 100%;
  margin-left: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.centerRightBotLiR {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: 15px;
}

.centerRightBotLiL > div:nth-child(1) img {
  width: 100%;
  height: 100%;
}

.centerRightBotLiL > div:nth-child(1) {
  width: 17px;
  height: 17px;
  border-radius: 3px;
  border: 1px solid #ececec;
  margin-right: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.centerRightBotLiL > div:nth-child(2) img {
  width: 100%;
  height: 100%;
}

.centerRightBotLiL > div:nth-child(2) {
  width: 17px;
  height: 17px;
  border-radius: 3px;
  border: 1px solid #ececec;
  margin-right: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.centerRightBotLiL > div:nth-child(3) {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  width: 250px;
}

.centerRightBotLiL {
  display: flex;
  align-items: center;
  justify-content: center;
}

.centerRightBot {
  height: 235px;
  margin-top: 5px;
  overflow-x: hidden;
  overflow-y: scroll;
}

.centerRightBot ul li:hover {
  background-color: #f6f6f6;
}

.centerRightBot ul li:nth-child(1) {
  margin-top: 20px;
}

.centerRightBot ul li {
  display: flex;
  align-items: center;
  height: 27px;
  width: 100%;
  cursor: pointer;
  padding-left: 15px;
  justify-content: space-between;
}

.centerRightBot {
  height: 365px;
  border-radius: 5px;
  background-color: #fff;
  border: 1px solid #fff;
}

.centerLeftBotFourLiR {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: 15px;
  color: #e7744a;
}

.centerLeftBotFourLiL > div:nth-child(3) {
  width: 17px;
  height: 17px;
  margin-right: 7px;
  margin-top: -6px;
}
.centerLeftBotFourLiL > div:nth-child(3) img {
  width: 100%;
  height: 100%;
}
.centerLeftBotFourLiL > div:nth-child(4) {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  width: 250px;
}
.centerLeftBotFourLiL > div:nth-child(1) img,
.centerLeftBotFourLiL > div:nth-child(2) img {
  width: 100%;
  height: 100%;
}

.centerLeftBotFourLiL > div:nth-child(1),
.centerLeftBotFourLiL > div:nth-child(2) {
  width: 17px;
  height: 17px;
  border-radius: 3px;
  border: 1px solid #ececec;
  margin-right: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.centerLeftBotFourLiL {
  display: flex;
  align-items: center;
  justify-content: center;
}

.centerLeftBotFour {
  height: 235px;
  margin-top: 5px;
  overflow-x: hidden;
  overflow-y: scroll;
}

.centerLeftBotFour ul li:hover {
  background-color: #f6f6f6;
}

.centerLeftBotFour ul li {
  display: flex;
  align-items: center;
  height: 27px;
  width: 100%;
  cursor: pointer;
  padding-left: 15px;
  justify-content: space-between;
}

.centerLeftBotThr {
  height: 25px;
  margin-top: 5px;
  display: flex;
  align-items: center;
}

.centerLeftBotThr > div:nth-child(1) {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 15px;
  margin-top: 5px;
}

.centerLeftBotThr > div:nth-child(2) {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
}

.centerLeftBotOne {
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.centerLeftBotOneL {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.centerLeftBotOneI input {
  height: 30px;
  border: none;
  line-height: 30px;
  vertical-align: baseline;
}

.centerLeftBotOneI {
  width: 310px;
  height: 30px;
  line-height: 30px;
  font-size: 15px;
  color: #000;
}

.centerLeftBotOne > div {
  width: 370px;
  height: 32px;
  border-radius: 3px;
  border: 1px solid #d1c4b9;
  display: flex;
  align-items: center;
}

.centerLeftBotTwo ul li > div:nth-child(2) {
  color: #e7744a;
  margin-right: 5px;
  margin-left: 5px;
  cursor: pointer;
}

.centerLeftBotTwo ul li:nth-child(1) > div:nth-child(2) {
  margin-left: 0px;
}

.centerLeftBotTwo ul {
  margin-left: 15px;
}

.centerLeftBotTwo ul li {
  float: left;
  display: flex;
}

.centerLeftBotTwo {
  min-height: 20px;
}

.centerLeftBot > div {
  width: 100%;
}

.centerLeftBot {
  height: 365px;
  border-radius: 5px;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #fff;
}

.centerLeftTop,
.centerRightTop {
  height: 45px;
  background-color: #f4f4f5;
  line-height: 55px;
  font-size: 16px;
  color: #000;
  padding-left: 5px;
}

.centerLeft {
  width: 400px;
  height: 410px;
  margin-left: 30px;
}

.centerRight {
  width: 400px;
  height: 410px;
  margin-left: 20px;
}

.ModalsmemTop {
  width: 100%;
  height: 66px;
  background-color: #fff;
  text-align: center;
  font-size: 16px;
  color: #303030;
  line-height: 66px;
}

.ModalsmemCenter {
  width: 100%;
  height: 410px;
  background-color: #f4f4f5;
  display: flex;
}

.ModalsmemBot {
  width: 100%;
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f4f4f5;
}

.ModalsmemBot > div {
  width: 80px;
  height: 35px;
  line-height: 35px;
  text-align: center;
  font-size: 16px;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
}

.ModalsmemBot > div:nth-child(1) {
  background-color: #e7744a;
  margin-right: 22px;
}

.ModalsmemBot > div:nth-child(2) {
  background-color: #aeaeae;
  margin-left: 22px;
}

.Modalsmem {
  width: 960px;
  height: 560px;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.5);
  animation: madalsBox 0.8s;
  background-color: #fff;
  display: flex;
  flex-wrap: wrap;
  border-radius: 4px;
}

@keyframes madalsBox {
  from {
    transform: translateY(-200px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.ModalsmemBox {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.1);
  z-index: 9999;
}
.centerLeftBotOneX img {
  cursor: pointer;
}
.grayColor {
  color: #ccc;
}
/* **********************弹出组件样式结束*************** */
</style>